var xmlHttp
function addFriend(str)
{ 

xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
 {
 alert ("Browser does not support HTTP Request")
 return
 }
var url="controller/addFriend.php";
url=url+"?"+str
url=url+"&sid="+Math.random()
xmlHttp.onreadystatechange=stateChanged 
xmlHttp.open("GET",url,true)
xmlHttp.send(null)
}

function stateChanged() 
{ 
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 { 
 alert(xmlHttp.responseText);
 } 
}

function GetXmlHttpObject()
{
var xmlHttp=null;
try
 {
 // Firefox, Opera 8.0+, Safari
 xmlHttp=new XMLHttpRequest();
 }
catch (e)
 {
 //Internet Explorer
 try
  {
  xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
  }
 catch (e)
  {
  xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
 }
return xmlHttp;
}

function resizeImage(ImgD,iwidth,iheight){ 
	 var image=new Image(); 
    image=ImgD; 
    if(image.width>0 && image.height>0){ 
       if(image.width/image.height>= iwidth/iheight){ 
          if(image.width>iwidth){ 
              ImgD.width=iwidth; 
              ImgD.height=(image.height*iwidth)/image.width; 
          }else{ 
                 ImgD.width=image.width; 
                 ImgD.height=image.height; 
               } 
              ImgD.alt=image.width+"×"+image.height; 
       } 
       else{ 
               if(image.height>iheight){ 
                      ImgD.height=iheight; 
                      ImgD.width=(image.width*iheight)/image.height; 
               }else{ 
                       ImgD.width=image.width; 
                       ImgD.height=image.height; 
                    } 
               ImgD.alt=image.width+"×"+image.height; 
           }
	 }
} 